package tpf.designer.pattern.course5.structure_pattern2.flyweight_13.simple;

/**
 * 具体的享元类
 */
public class ConcreteFlyweight implements Flyweight {

    //享元对象的内蕴状态,其在享元对象创建时赋予,且在对象创建之后不再改变.
    private Character intrinsicState = null;

    public ConcreteFlyweight(Character intrinsicState) {
        this.intrinsicState = intrinsicState;
    }

    /**
     * 外蕴状态作为参量传入方法，改变方法的行为但是并不改变对象的内蕴状态
     * @param state
     */
    @Override
    public void operation(String state) {
        System.out.println("\n 内蕴状态：" + intrinsicState + ", 外蕴状态：" + state);
    }
}
